package com.htwy.ext;

import com.jfinal.template.Directive;
import com.jfinal.template.Env;
import com.jfinal.template.io.CharWriter;
import com.jfinal.template.io.FastStringWriter;
import com.jfinal.template.stat.Scope;

public abstract class ExtDirective extends Directive {

    protected String getContent(Env env, Scope scope) {
        String content = null;
        CharWriter charWriter = new CharWriter(64);
        FastStringWriter fsw = new FastStringWriter();
        charWriter.init(fsw);
        try {
            stat.exec(env, scope, charWriter);
            content = fsw.toString();
        }finally {
            charWriter.close();
        }
        return content;
    }

}
